package com.wzq.controller.pc;

import com.wzq.service.IUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 文件上传
 * @author zgx
 */
@RestController
@RequestMapping("/PC/upload")
public class PCUploadController {

    @Autowired
    private IUploadService iUploadService;

    /**
     * 视频文件上传
     */
    @RequestMapping(value ="/uploadVideo",method= RequestMethod.POST)
    public Map<String, Object> uploadVideo(MultipartFile file, HttpServletRequest request) throws Exception{
        return iUploadService.uploadVideo(file, request);
    }

    /**
     * 图片文件上传
     */
//    @RequestMapping(value ="/uploadImage",method=RequestMethod.POST)
//    public Map<String, Object> uploadImage(MultipartFile file,HttpServletRequest request) throws Exception{
//        return iUploadService.uploadImage(file, request);
//    }

    /**
     * 图片文件上传
     */
    @PostMapping("/uploadImage")
    public Map<String, Object> fileUpload(@RequestParam("con") MultipartFile fileImage,HttpServletRequest request) throws Exception{
        return iUploadService.uploadImage(fileImage,request);

    }

}
